import Mock from 'mockjs'

Mock.mock('/login', 'post', (options) => {
    console.log('options:', options)
    let data = JSON.parse(options.body)
    let name = data.name
    let password = data.password
    if (name === 'admin' && password === 'admin') {
        return {
            status: 1,
            message: '登录成功'
        }
    } else {
        return {
            status: 0,
            message: '账号或者密码错误'
        }
    }
})
Mock.mock('/api/getTipData', 'get', () => {
    return {
        tips: [
            {
                tipId: 1,
                tipIsKnot: 0,
                tipIsdeleted: 0,
                tipReplies: 10,
                tipClick: 10,
                tipPublishTime: "2018-9-9",
                tipModifyTime: "2019-1-1",
                tabName: "tabName",
                tipTitle: "测试1234566789",
                userId: 1,
                userNick: "aaaaaa",
                userName: "UserName",
                forumName: "你好吗"
            },
            {
                tipId: 2,
                tipIsKnot: 0,
                tipIsdeleted: 0,
                tipReplies: 10,
                tipClick: 10,
                tipPublishTime: "2018-9-9",
                tipModifyTime: "2019-1-1",
                tabName: "tabName",
                tipTitle: "测试1234566789",
                userId: 1,
                userNick: "BBBB",
                userName: "UserName",
                forumName: "你好吗"
            },
            {
                tipId: 3,
                tipIsKnot: 0,
                tipIsdeleted: 0,
                tipReplies: 10,
                tipClick: 10,
                tipPublishTime: "2018-9-9",
                tipModifyTime: "2019-1-1",
                tabName: "tabName",
                tipTitle: "测试1234566789",
                userId: 1,
                userNick: "CCCCCC",
                userName: "UserName",
                forumName: "你好吗"
            },
            {
                tipId: 4,
                tipIsKnot: 0,
                tipIsdeleted: 0,
                tipReplies: 10,
                tipClick: 10,
                tipPublishTime: "2018-9-9",
                tipModifyTime: "2019-1-1",
                tabName: "tabName",
                tipTitle: "测试1234566789",
                userId: 1,
                userNick: "DDDDD",
                userName: "UserName",
                forumName: "你好吗"
            }
        ]
    }
})

Mock.mock(RegExp("/api/getTip"+"*"), 'get', () => {
    console.log("/api/getTip")
  return {
    replys: [{
      replyPublishtime: '2019-1-1',
      replyContent: '假的',
      user: {
        userId: 1,
        userName: '张三'
      }
    }
      , {
      replyPublishtime: '2019-1-1',
      replyContent: '假的',
      user: {
        userId: 2,
        userName: '李四'
      }
    },
    {
      replyPublishtime: '2019-1-1',
      replyContent: '假的',
      user: {
        userId: 3,
        userName: '王五'
      }
    },
    {
      replyPublishtime: '2019-1-1',
      replyContent: '假的',
      user: {
        userId: 4,
        userName: '大大'
      }
    }
      , {
      replyPublishtime: '2019-1-1',
      replyContent: '假的',
      user: {
        userId: 5,
        userName: '叶晨'
      }
    }],
    tip: {
      tipTitle: "活动管理",
      tipReplies: 10,
      tipClick: 100,
      tipContent: '明天放假'
    }
  }
})